﻿#pragma once

#include "../Enums.h"
#include <string>

class IntelligentCreatureRules
{
public:
    int MinimalFullness = 1;

    bool MousePickupEnabled = false;
    int MousePickupRange = 0;
    bool AutoPickupEnabled = false;
    int AutoPickupRange = 0;
    bool SemiAutoPickupEnabled = false;
    int SemiAutoPickupRange = 0;

    bool CanProduceBlackStone = false;

    IntelligentCreatureRules();

    IntelligentCreatureRules(BinaryReader *reader);

    void Save(BinaryWriter *writer);
};

class IntelligentCreatureItemFilter
{
public:
    bool PetPickupAll = true;
    bool PetPickupGold = false;
    bool PetPickupWeapons = false;
    bool PetPickupArmours = false;
    bool PetPickupHelmets = false;
    bool PetPickupBoots = false;
    bool PetPickupBelts = false;
    bool PetPickupAccessories = false;
    bool PetPickupOthers = false;

    ItemGrade PickupGrade = ItemGrade::None;

    IntelligentCreatureItemFilter();

    void SetItemFilter(int idx);

    IntelligentCreatureItemFilter(BinaryReader *reader);

    void Save(BinaryWriter *writer);
};

class ClientIntelligentCreature
{
public:
    IntelligentCreatureType PetType = static_cast<IntelligentCreatureType>(0);
    int Icon = 0;

    std::string CustomName;
    int Fullness = 0;
    int SlotIndex = 0;
    DateTime Expire;
    long long BlackstoneTime = 0;
    long long MaintainFoodTime = 0;

    IntelligentCreaturePickupMode petMode = IntelligentCreaturePickupMode::SemiAutomatic;

    IntelligentCreatureRules *CreatureRules;
    IntelligentCreatureItemFilter *Filter;


    virtual ~ClientIntelligentCreature()
    {
        delete CreatureRules;
        delete Filter;
    }

    ClientIntelligentCreature();

    ClientIntelligentCreature(BinaryReader *reader);

    void Save(BinaryWriter *writer);
};
